#include<iostream> 
using namespace std;

class Solution {
public:
    int reverse(int x) {
    	long long test = x;
    	bool flag = false;
    	string s = "";
        if(test < 0){
        	flag = true;
        	test = -test;
		}
		while(test){
			s += '0' + test % 10;
			test /= 10; 
		}
		long long ans = 0;
		for(int i = 0; i < s.length(); i++){
			ans += s[i] - '0';
			if(i < s.length() - 1)ans *= 10;
		} 
		if(ans >= 2147483648LL)ans = 0;
		return flag ? -ans : ans;
    }
};


int main(){
	Solution a;
	int n = -2147483648;
	cout << a.reverse(n);
	return 0;
}

//2020.9.17
